/*
 * @Author: szx
 * @Date: 2021-12-15 13:38:06
 * @LastEditTime: 2021-12-15 13:53:18
 * @Description:
 * @FilePath: \leetcode\1-99\94\94.js
 */
/**
 * @param {TreeNode} root
 * @return {number[]}
 */
var inorderTraversal = function (root) {
    const res = [];
    const dfs = (node) => {
        if (node === null) return;
        dfs(node.left);
        res.push(node.val);
        dfs(node.right);
    };
    dfs(root);
    return res;
};
var inorderTraversal = function (root) {
    const res = [];
    if (root == null) return [];
    const stk = [];
    while (stk.length != 0 || root) {
        while (root) {
            stk.push(root);
            root = root.left;
        }
        let tmp = stk.pop();
        res.push(tmp.val);
        root = tmp.right;
    }
    return res;
};
